package com.huluobo.a1903librarydemo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.launcher.ARouter;

public class MainActivity extends AppCompatActivity {
    private FragmentManager fragmentManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        fragmentManager = getSupportFragmentManager();
        Fragment fragment= (Fragment) ARouter.getInstance().build("/home/fragment").navigation();
        fragmentManager.beginTransaction().replace(R.id.container,fragment).commit();
    }

    public void home(View view){
        Fragment fragment= (Fragment) ARouter.getInstance().build("/home/fragment").navigation();
        fragmentManager.beginTransaction().replace(R.id.container,fragment).commit();
    }

    public void project(View view){
        Fragment fragment= (Fragment) ARouter.getInstance().build("/project/fragment").navigation();
        fragmentManager.beginTransaction().replace(R.id.container,fragment).commit();
    }

    public void user(View view){
        Fragment fragment= (Fragment) ARouter.getInstance().build("/user/fragment").navigation();
        fragmentManager.beginTransaction().replace(R.id.container,fragment).commit();
    }
}